﻿<f:MetroWindow
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:f="clr-namespace:Fluent;assembly=Fluent" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:vm="clr-namespace:Beaker.OpenCube.WorldViewer.ViewModels"
	xmlns:conv="clr-namespace:Beaker.OpenCube.WorldViewer.Converters" xmlns:sys="clr-namespace:System;assembly=mscorlib"
	mc:Ignorable="d" x:Class="Beaker.OpenCube.WorldViewer.MainWindow"
	Title="{Binding WorldName, Converter={StaticResource StringFormatConverter}, ConverterParameter={StaticResource WindowTitle}}" SnapsToDevicePixels="True" WindowState="Maximized"
	f:MetroWindow.RibbonThemeColor="#71A818"
	ResizeMode="CanResizeWithGrip"
	TextOptions.TextFormattingMode="Display" Icon="Resources/Icons/Logo256.ico"
>
	<f:MetroWindow.Resources>
		<ResourceDictionary>
			<Style x:Key="Title" TargetType="Label">
				<Setter Property="FontFamily" Value="Segoe UI Light" />
				<Setter Property="FontSize" Value="40pt" />
				<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
			</Style>
			<BooleanToVisibilityConverter x:Key="BoolVisConverter" />
		</ResourceDictionary>
	</f:MetroWindow.Resources>
	<f:MetroWindow.DataContext>
		<StaticResource ResourceKey="MainViewModel"/>
	</f:MetroWindow.DataContext>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>
		<f:Ribbon>
			<f:Ribbon.Menu>
				<f:Backstage Header="FILE">
					<f:BackstageTabControl>
						<f:BackstageTabItem Header="Profiles">
							<Grid Margin="50">
								<Grid.RowDefinitions>
									<RowDefinition Height ="Auto" />
									<RowDefinition Height ="50" />
									<RowDefinition Height ="*" />
								</Grid.RowDefinitions>
								<Label Style="{StaticResource Title}">Available Profiles</Label>
								<ScrollViewer Grid.Row="2">
									<ItemsControl ItemsSource="{Binding Profiles}">
										<ItemsControl.ItemsPanel>
											<ItemsPanelTemplate>
												<WrapPanel />
											</ItemsPanelTemplate>
										</ItemsControl.ItemsPanel>
									</ItemsControl>
								</ScrollViewer>
							</Grid>
						</f:BackstageTabItem>
						<f:BackstageTabItem Header="Open">
							<Grid Margin="50">
								<Grid.RowDefinitions>
									<RowDefinition Height ="Auto" />
									<RowDefinition Height ="50" />
									<RowDefinition Height ="*" />
								</Grid.RowDefinitions>
								<Label Style="{StaticResource Title}">Available Worlds</Label>
								<ScrollViewer Grid.Row="2">
									<ItemsControl ItemsSource="{Binding Worlds}">
										<ItemsControl.ItemsPanel>
											<ItemsPanelTemplate>
												<WrapPanel />
											</ItemsPanelTemplate>
										</ItemsControl.ItemsPanel>
									</ItemsControl>
								</ScrollViewer>
							</Grid>
						</f:BackstageTabItem>
						<f:BackstageTabItem Header="Textures">
							<Grid Margin="50">
								<Grid.RowDefinitions>
									<RowDefinition Height ="Auto" />
									<RowDefinition Height ="50" />
									<RowDefinition Height ="*" />
								</Grid.RowDefinitions>
								<Label Style="{StaticResource Title}">Available TexturePacks</Label>
								<ScrollViewer Grid.Row="2">
									<ItemsControl ItemsSource="{Binding TexturePacks}">
										<ItemsControl.ItemsPanel>
											<ItemsPanelTemplate>
												<WrapPanel />
											</ItemsPanelTemplate>
										</ItemsControl.ItemsPanel>
									</ItemsControl>
								</ScrollViewer>
							</Grid>
						</f:BackstageTabItem>
						<f:BackstageTabItem Header="Options">
							<Grid Margin="50">
								<Grid.RowDefinitions>
									<RowDefinition Height ="Auto" />
									<RowDefinition Height ="50" />
									<RowDefinition Height ="*" />
								</Grid.RowDefinitions>
								<Label Style="{StaticResource Title}">Options</Label>
							</Grid>
						</f:BackstageTabItem>
					</f:BackstageTabControl>
				</f:Backstage>
			</f:Ribbon.Menu>
			<f:Ribbon.ContextualGroups>
				<f:RibbonContextualTabGroup x:Name="Map"  Header="MAP TOOLS" Visibility="{Binding IsInMapMode, Converter={StaticResource BoolVisConverter}}" Background="Green" BorderBrush="Green" />
				<f:RibbonContextualTabGroup x:Name="Chunk" Header="CHUNK TOOLS" Visibility="{Binding IsInChunkMode, Converter={StaticResource BoolVisConverter}}" Background="Blue" BorderBrush="Blue" />
				<f:RibbonContextualTabGroup x:Name="Render" Header="RENDER TOOLS" Visibility="{Binding IsInRenderMode, Converter={StaticResource BoolVisConverter}}" Background="Red" BorderBrush="Red" />
				<f:RibbonContextualTabGroup x:Name="Ore" Header="ORE TOOLS" Visibility="Visible" Background="Gold" BorderBrush="Gold" />
			</f:Ribbon.ContextualGroups>
			<f:RibbonTabItem Header="HOME">
				<f:RibbonGroupBox Header="Mode">
					<f:InRibbonGallery>
						<f:GalleryItem  Command="{Binding SetModeCommand}" CommandParameter="{x:Static vm:ViewMode.Map}">
							<f:GalleryItem.ToolTip>
								<f:ScreenTip Title="Map" Text="Switches to map view/edit mode."/>
							</f:GalleryItem.ToolTip>
							<Image Source="Resources/48/Map.png" Width="48" Height="48"/>
						</f:GalleryItem>
						<f:GalleryItem Command="{Binding SetModeCommand}" CommandParameter="{x:Static vm:ViewMode.Chunk}">
							<f:GalleryItem.ToolTip>
								<f:ScreenTip Title="Chunk" Text="Switches to chunk view/edit mode."/>
							</f:GalleryItem.ToolTip>
							<Image Source="Resources/48/Chunk.png" Width="48" Height="48"/>
						</f:GalleryItem>
						<f:GalleryItem Command="{Binding SetModeCommand}" CommandParameter="{x:Static vm:ViewMode.Render}">
							<f:GalleryItem.ToolTip>
								<f:ScreenTip Title="Render" Text="Switches to render mode."/>
							</f:GalleryItem.ToolTip>Render</f:GalleryItem>
					</f:InRibbonGallery>
				</f:RibbonGroupBox>
				<f:RibbonGroupBox Header="Dimension">
					<f:InRibbonGallery>
						<f:GalleryItem>
							<f:GalleryItem.ToolTip>
								<f:ScreenTip Title="Overworld" Text="Switches to the overworld."/>
							</f:GalleryItem.ToolTip>
							<Image Source="Resources/48/Overworld.png" Width="48" Height="48" Margin="2"/>
						</f:GalleryItem>
						<f:GalleryItem>
							<f:GalleryItem.ToolTip>
								<f:ScreenTip Title="Nether" Text="Switches to the nether."/>
							</f:GalleryItem.ToolTip>
							<Image Source="Resources/48/Nether.png" Width="48" Height="48" Margin="2"/>
						</f:GalleryItem>
						<f:GalleryItem>
							<f:GalleryItem.ToolTip>
								<f:ScreenTip Title="The End" Text="Switches to the end."/>
							</f:GalleryItem.ToolTip>
							<Image Source="Resources/48/TheEnd.png" Width="48" Height="48" Margin="2"/>
						</f:GalleryItem>
					</f:InRibbonGallery>
				</f:RibbonGroupBox>
			</f:RibbonTabItem>
			<f:RibbonTabItem Header="NAVIGATE" Group="{Binding ElementName=Map}"></f:RibbonTabItem>
			<f:RibbonTabItem Header="EDIT" Group="{Binding ElementName=Map}"></f:RibbonTabItem>
			<f:RibbonTabItem Header="EDIT" Group="{Binding ElementName=Chunk}"></f:RibbonTabItem>
			<f:RibbonTabItem Header="CAMERA" Group="{Binding ElementName=Render}"></f:RibbonTabItem>
			<f:RibbonTabItem Header="LIGHTING" Group="{Binding ElementName=Render}"></f:RibbonTabItem>
			<f:RibbonTabItem Header="SKY" Group="{Binding ElementName=Render}"></f:RibbonTabItem>
		</f:Ribbon>
		<ContentPresenter Grid.Row="1" Content="{Binding ActiveView}" />
	</Grid>
</f:MetroWindow>
